package com.woniuxy01;

import java.util.Scanner;

/**
 * @author 作者
 * @create 2025-10-24 9:55
 */
public class Test03 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String username, password;
        boolean flag = false;
        for (int i = 1; i <= 3; i++) {
            System.out.println("输入用户名");
            username = scanner.next();
            System.out.println("输入密码");
            password = scanner.next();
            if (username.equals("a") && password.equals("aaa")) {
                flag = true;
                break;
            } else {
                System.out.println("用户名密码错误，还有" + (3 - i) + "次机会");
            }
        }
        if(flag){
            System.out.println("登录成功，还原使用系统");
        }else{
            System.out.println("3次输入错误，无法进入系统");
        }

    }
}
